# Contributor: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
# Maintainer: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
pkgname=scryer-prolog
pkgver=0.9.4
pkgrel=0
pkgdesc="Modern Prolog implementation written in Rust"
url="https://github.com/mthom/scryer-prolog"
# s390x: nix crate
arch="all !s390x"
license="BSD-3-Clause"
makedepends="
	cargo>1.74
	cargo-auditable
	libffi-dev
	libsodium-dev
	m4
	openssl-dev>3
	rustfmt
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mthom/scryer-prolog/archive/refs/tags/v$pkgver.tar.gz
	fix-ffi-warp.patch
	"

# system libs
export OPENSSL_NO_VENDOR=1
export CARGO_FEATURE_USE_SYSTEM_LIBS=1
export SODIUM_USE_PKG_CONFIG=1


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/scryer-prolog -t "$pkgdir"/usr/bin
}

sha512sums="
1352318b8d03aa1ccac0009fd860cae6dda8d5113b661640a402c22700d0f9e0176eec4d4433653ea203ff128c2da9a9785c5e15fe5b55bdcbc226fa80f10cc3  scryer-prolog-0.9.4.tar.gz
0d55b90824ad63be3c8821189650d79819f502f2acfcd9ae87516c72bcd8b0d50682df0dc489b4ae060dcd0131bbc1bbd56057f48ee245aeb2207f80e5838006  fix-ffi-warp.patch
"
